#!/bin/bash

# 获取脚本所在目录的绝对路径
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# 停止并移除旧容器
docker-compose -f "$SCRIPT_DIR/docker-compose.yml" down

# 构建新镜像
docker-compose -f "$SCRIPT_DIR/docker-compose.yml" build

# 启动新容器
docker-compose -f "$SCRIPT_DIR/docker-compose.yml" up -d

# 显示容器状态
docker-compose -f "$SCRIPT_DIR/docker-compose.yml" ps

docker-compose -f "$SCRIPT_DIR/docker-compose.yml" logs -f
# echo "部署完成！"
# echo "前端服务: http://localhost:3000 (通过nginx反向代理)"
# echo "后端API: http://localhost:8001"
# echo "数据库: PostgreSQL (端口5432)"
# echo "缓存: Redis (端口6379)"
